package design.factory.first;

import design.factory.first.model.HuaweiPhone;
import design.factory.first.model.Phone;
import design.factory.first.model.XiaomiPhone;

/**
 * 手机工厂
 */
public class PhoneFactory {

    /**
     * 生产手机
     * @param model 要生产的手机的型号
     * @return
     */
    public static Phone createPhone(String model) {
        switch (model) {
            case "xiaomi":
                return new XiaomiPhone();
            case "huawei":
                return new HuaweiPhone();
            default:
                return null;
        }
    }

}
